package com.example.shopping.service;

import com.example.shopping.entity.Province;
import com.example.shopping.repository.ProvinceRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProvinceServiceImpl implements ProvinceService{
    @Autowired
    private ProvinceRepository provinceRepository;

    @Override
    public Object findAll() {
        return provinceRepository.findAll();
    }

    @Override
    public Province findByPid(String pid) {
        return provinceRepository.findByPid(pid);
    }

    @Override
    public void updateProvince(Province province) {
        provinceRepository.save(province);
    }

    @Override
    public void deleteByPid(String pid) {
        provinceRepository.deleteById(pid);
    }

    @Override
    public void saveProvince(Province province) {
        provinceRepository.save(province);
    }
}
